<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.util.Info"%>
<%@page import="com.dao.CommonDAO"%>
<%@page import="com.util.PageManager"%>
<%@page import="com.model.Sysuser"%>
<%@page import="com.model.Notice"%>
<%@page import="com.model.Familyda"%>
<%@page import="com.model.Familycy"%>
<%@page import="com.model.Ryfb"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理页面</title>
<!-- 调用CSS，JS -->
<link href="/wearablehealthymonitorsys/admin/images/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
<script language=javascript src='/wearablehealthymonitorsys/js/ajax.js'></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-family: "宋体";
	font-size: 12px;
	color: #333333;
	background-color: ;
}
.STYLE1 {
	color: #333333;
	font-size: x-large;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
 <style type="text/css">  
    html{height:100%}    
    body{height:100%;margin:0px;padding:0px}    
    #container{height:100%}    
</style>
<script language="javascript">
function window.onload() { 

if(top.location != self.location){ 

var a = window.parent.document.getElementsByTagName('iframe'); 

for (var i=0; i<a.length; i++){ 

if (a[i].name == self.name) {a[i].height = document.body.scrollHeight+320; return;}}} 
} 
</script>

</head>
<body>
  <% 
  CommonDAO dao = (CommonDAO)Info.getDao(request,"CommonDAO");
  Sysuser user = (Sysuser)session.getAttribute("user"); 
  %>


						

						<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BBD3EB">
						<th>人员分布图</th>
                        
                     
                          <tr>
                            <td height=500 align="center" bgcolor="#FFFFFF">
                            
    <%ArrayList<Ryfb> list = (ArrayList<Ryfb>)dao.findByHql( "from Ryfb");%>
    <div id="container" ></div> 
	<script type="text/javascript"> 
	
	function add(x,y){
		 f1.x.value=x;
		 f1.y.value=y;
	}
	
	
	var map = new BMap.Map("container");          // 创建地图实例  
		//map.centerAndZoom(new BMap.Point(113.551974,22.270506), 15);
		map.centerAndZoom('珠海');  
	setTimeout(function(){
		map.setZoom(14);   
	}, 2000);  //2秒后放大到14级
	var point = new BMap.Point(113.581, 22.276);  // 创建点坐标  
	map.centerAndZoom(point, 15);                 // 初始化地图，设置中心点坐标和地图级别
	
	function myFun(result){
		var cityName = result.name;
		map.setCenter(cityName);
	}
	//var myCity = new BMap.LocalCity();
	//myCity.get(myFun);
	
	var bbb;

	<%
	String aaa = "[";
	for(int i=0;i<list.size();i++){
		Ryfb map = (Ryfb)list.get(i);
		aaa += "["+map.getX()+","+map.getY()+",'姓名："+map.getTname()+"']";
		if(i+1!=list.size()){
			aaa+=",";
		}
	}
	aaa+="]";
	%>
	bbb = <%=aaa%>;
	var data_info = bbb;
	
	var opts = {
				width : 250,     // 信息窗口宽度
				height: 180,     // 信息窗口高度
				title : "信息窗口" , // 信息窗口标题
				enableMessage:true//设置允许信息窗发送短息
			   };
	for(var i=0;i<data_info.length;i++){
		var marker = new BMap.Marker(new BMap.Point(data_info[i][0],data_info[i][1]));  // 创建标注
		var content = data_info[i][2];
		map.addOverlay(marker);               // 将标注添加到地图中
		addClickHandler(content,marker);
	}
	
	function addClickHandler(content,marker){
		marker.addEventListener("click",function(e){
			openInfo(content,e)}
		);
	}
	function openInfo(content,e){
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象 
		map.openInfoWindow(infoWindow,point); //开启信息窗口
	}
	</script>  
                            </td>
                          </tr>
                          
</table>      
</form>                 
</body>
</html>
